#ifndef TIMER_H
#define TIMER_H
#include <avr/io.h>
//	TCCR0A
#define OC0A_COM_TOGGLE 	_BV(COM0A0)
#define OC0A_COM_SET 		(_BV(COM0A1) | _BV(COM0A0))
#define OC0A_COM_CLEAN 		_BV(COM0A1)
#define OC0B_COM_TOGGLE 	_BV(COM0B0)
#define OC0B_COM_SET 		(_BV(COM0B1) | _BV(COM0B0))
#define OC0B_COM_CLEAN 		_BV(COM0B1)
#define T0_WGM_8 			_BV(WGM00)
#define T0_WGM_9 			_BV(WGM01)
#define T0_WGM_10 			(_BV(WGM01) | _BV(WGM00))
#define OC0A_WGM_NONCONVERT	_BV(COM0A1)
#define OC0A_WGM_CONVERT	(_BV(COM0A1) | _BV(COM0A0))
#define OC0B_WGM_NONCONVERT	_BV(COM0A1)
#define OC0B_WGM_CONVERT	(_BV(COM0A1) | _BV(COM0A0))
//	TCCR0B
#define T0_CS_CK 			_BV(CS00)
#define T0_CS_DIV8 			_BV(CS01)
#define T0_CS_DIV64 		(_BV(CS01) | _BV(CS00))
#define T0_CS_DIV256		_BV(CS02)
#define T0_CS_DIV1024		(_BV(CS02) | _BV(CS00))
#define T0_CS_T0_RISE		(_BV(CS02) | _BV(CS01))
#define T0_CS_T0_FALL		(_BV(CS02) | _BV(CS01) | _BV(CS00))
//	TCCR1A
#define OC1A_COM_TOGGLE 	_BV(COM1A0)
#define OC1A_COM_SET 		(_BV(COM1A1) | _BV(COM1A0))
#define OC1A_COM_CLEAN 		_BV(COM1A1)
#define OC1B_COM_TOGGLE 	_BV(COM1B0)
#define OC1B_COM_SET 		(_BV(COM1B1) | _BV(COM1B0))
#define OC1B_COM_CLEAN 		_BV(COM1B1)
#define T1_WGM_8 			_BV(WGM10)
#define T1_WGM_9 			_BV(WGM11)
#define T1_WGM_10 			(_BV(WGM11) | _BV(WGM10))
#define OC1A_WGM_NONCONVERT	_BV(COM1A1)
#define OC1A_WGM_CONVERT	(_BV(COM1A1) | _BV(COM1A0))
#define OC1B_WGM_NONCONVERT	_BV(COM1A1)
#define OC1B_WGM_CONVERT	(_BV(COM1A1) | _BV(COM1A0))
//	TCCR1B
#define T1_CS_CK 			_BV(CS10)
#define T1_CS_DIV8 			_BV(CS11)
#define T1_CS_DIV64 		(_BV(CS11) | _BV(CS10))
#define T1_CS_DIV256		_BV(CS12)
#define T1_CS_DIV1024		(_BV(CS12) | _BV(CS10))
#define T1_CS_T1_RISE		(_BV(CS12) | _BV(CS11))
#define T1_CS_T1_FALL		(_BV(CS12) | _BV(CS11) | _BV(CS10))
//	TCCR2A
#define OC2A_COM_TOGGLE 	_BV(COM2A0)
#define OC2A_COM_SET 		(_BV(COM2A1) | _BV(COM2A0))
#define OC2A_COM_CLEAN 		_BV(COM2A1)
#define OC2B_COM_TOGGLE 	_BV(COM2B0)
#define OC2B_COM_SET 		(_BV(COM2B1) | _BV(COM2B0))
#define OC2B_COM_CLEAN 		_BV(COM2B1)
#define T2_WGM_8 			_BV(WGM20)
#define T2_WGM_9 			_BV(WGM21)
#define T2_WGM_10 			(_BV(WGM21) | _BV(WGM20))
#define OC2A_WGM_NONCONVERT	_BV(COM2A1)
#define OC2A_WGM_CONVERT	(_BV(COM2A1) | _BV(COM2A0))
#define OC2B_WGM_NONCONVERT	_BV(COM2A1)
#define OC2B_WGM_CONVERT	(_BV(COM2A1) | _BV(COM2A0))
//	TCCR1B
#define T2_CS_CK 			_BV(CS20)
#define T2_CS_DIV8 			_BV(CS21)
#define T2_CS_DIV64 		(_BV(CS21) | _BV(CS20))
#define T2_CS_DIV256		_BV(CS22)
#define T2_CS_DIV1024		(_BV(CS22) | _BV(CS20))
#endif
